#include "share.hpp"

void writer(int Client_fd)
{
    string s;

    while(1)
    {
        cout << "please input commend:";
        getline(cin, s);

        if(s == "quit") break;

        ssize_t return_write_val = write(Client_fd, s.c_str(), s.size());
        if(return_write_val < 0)
        {
            cout << "write error:" << errno << " reason :" << strerror(errno) << endl; 
        }
        
        cout << "write success" << endl;      
    }

    close(Client_fd);
}

int main()
{

    int Client_fd = open(Path, O_WRONLY);
    if(Client_fd < 0)
    {
        cout << "Client open error:" << errno << " reason :" << strerror(errno) << endl; 
    }

    writer(Client_fd);

    return 0;
}